package com.example.controller;

import com.example.entity.Page.PageRequest;
import com.example.entity.Staffs;
import com.example.result.CommonResult;
import com.example.service.StaffsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: tobed
 * @date: 2022/11/14
 * @time: 14:06
 */
@RestController
@RequestMapping("Staffs")
public class StaffsController {

    @Autowired
    StaffsService staffsService;

    /*员工查询*/
    @RequestMapping("list")
    public CommonResult list(Staffs staffs, PageRequest pageRequest){
        CommonResult commonResult = staffsService.list(staffs,pageRequest);
        return commonResult;
    }

    /*重置密码*/
    @RequestMapping("rest/{id}")
    public CommonResult rest(@PathVariable Integer id){
        CommonResult commonResult = staffsService.rest(id);
        return commonResult;
    }

    /*修改用户状态*/
    @RequestMapping("updateSTatus/{id}/{status}")
    public CommonResult updateSTatus(@PathVariable Integer id,@PathVariable int status){
        CommonResult commonResult = staffsService.updateSTatus(id,status);
        return commonResult;
    }

}
